﻿#region Header

/*
Behavioral Rating of Dancing Human Crowds based on Motion Patterns
By

Pascal Hauser 
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

and

Raphael Gfeller
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

*/

#endregion

#region Usings

using System.Collections.Generic;
using Utils;

#endregion

namespace paravili.Steps {
	/// <summary>
	/// Description of the class
	/// </summary>
	public class ProcessStepFlattener {
		#region Public Properties

		public IList<ProcessStepEntry> Steps { get; private set; }

		#endregion

		#region Public Methods

		public ProcessStepFlattener(IProcessStep rootStep) {
			var manager = new ConfigurableValuesManager(rootStep);
			Steps = new List<ProcessStepEntry>();
			IProcessStep currentStep = rootStep;
			while (currentStep != null) {
				var toAdd = new ProcessStepEntry { Step = currentStep, Name = currentStep.GetType().Name };
				foreach (ConfigurableValueEntry entry in manager.GetConfigurationValues(currentStep)) {
					toAdd.ConfigurableValues.Add(entry);
				}
				Steps.Add(toAdd);
				currentStep = currentStep.GetNextStep();
			}
		}

		#endregion

		#region Private Methods

		// private methods located here

		#endregion

		#region Private Fields

		// private fields located here

		#endregion
	}

	public class ProcessStepEntry {
		public ProcessStepEntry() {
			ConfigurableValues = new List<ConfigurableValueEntry>();
		}

		public string Name { get; set; }
		public IProcessStep Step { get; set; }
		public IList<ConfigurableValueEntry> ConfigurableValues { get; set; }
	}
}